--SO
alter table so_t add tmpIdentity numeric(8,0) not null constraint df_so_t_tmpIdentity default 0
 go
update so_t set tmpIdentity = nIdentity
 
alter table so_t drop constraint df_so_t_tmpIdentity
alter table so_t drop column nIdentity 
 
EXEC sp_rename 'so_t.tmpIdentity','nIdentity','COLUMN'
go

--SALES
alter table sales_t add tmpIdentity numeric(8,0) not null constraint df_sales_t_tmpIdentity default 0
 go
update sales_t set tmpIdentity = nIdentity
 
alter table sales_t drop constraint df_sales_t_tmpIdentity
alter table sales_t drop column nIdentity 
 
EXEC sp_rename 'sales_t.tmpIdentity','nIdentity','COLUMN'
go

--AR
alter table AR_T add tmpIdentity numeric(8,0) not null constraint df_AR_T_tmpIdentity default 0
 go
update AR_T set tmpIdentity = nIdentity
 
alter table AR_T drop constraint df_AR_T_tmpIdentity
alter table AR_T drop column nIdentity 
 
EXEC sp_rename 'AR_T.tmpIdentity','ar_t','COLUMN'


GO 

--PR
alter table PR_T add tmpIdentity numeric(8,0) not null constraint df_PR_T_tmpIdentity default 0
 go
update PR_T set tmpIdentity = nIdentity
 
alter table PR_T drop constraint df_PR_T_tmpIdentity
alter table PR_T drop column nIdentity 
 
EXEC sp_rename 'PR_T.tmpIdentity','nIdentity','COLUMN'
GO
-----------------------------------------------------------------------------------------------
alter table PR_MAP add tmpIdentity numeric(8,0) not null constraint df_PR_MAP_tmpIdentity default 0
 go
update PR_MAP set tmpIdentity = nIdentity
 
alter table PR_MAP drop constraint df_PR_MAP_tmpIdentity
alter table PR_MAP drop column nIdentity 
 
EXEC sp_rename 'PR_MAP.tmpIdentity','nIdentity','COLUMN'
GO


SELECT * FROM PR_MAP 
-----------------------------------------------------------------------------------------------
alter table PR_O add tmpIdentity numeric(8,0) not null constraint df_PR_O_tmpIdentity default 0
 go
update PR_O set tmpIdentity = nIdentity
 
alter table PR_O drop constraint df_PR_O_tmpIdentity
alter table PR_O drop column nIdentity 
 
EXEC sp_rename 'PR_O.tmpIdentity','nIdentity','COLUMN'
GO
-----------------------------------------------------------------------------------------------
alter table PR_C add tmpIdentity numeric(8,0) not null constraint df_PR_C_tmpIdentity default 0
 go
update PR_C set tmpIdentity = nIdentity
 
alter table PR_C drop constraint df_PR_C_tmpIdentity
alter table PR_C drop column nIdentity 
 
EXEC sp_rename 'PR_C.tmpIdentity','nIdentity','COLUMN'
GO

--DR
alter table dr_t add tmpIdentity numeric(8,0) not null constraint df_dr_t_tmpIdentity default 0
 go
update dr_t set tmpIdentity = nIdentity
 
alter table dr_t drop constraint df_dr_t_tmpIdentity
alter table dr_t drop column nIdentity 
 
EXEC sp_rename 'dr_t.tmpIdentity','nIdentity','COLUMN'
GO

--PO
alter table po_t add tmpIdentity numeric(8,0) not null constraint df_po_t_tmpIdentity default 0
 go
update po_t set tmpIdentity = nIdentity
 
alter table po_t drop constraint df_po_t_tmpIdentity
alter table po_t drop column nIdentity 
 
EXEC sp_rename 'po_t.tmpIdentity','nIdentity','COLUMN'
GO

--purchase
alter table purchase_t add tmpIdentity numeric(8,0) not null constraint df_purchase_t_tmpIdentity default 0
 go
update purchase_t set tmpIdentity = nIdentity
 
alter table purchase_t drop constraint df_purchase_t_tmpIdentity
alter table purchase_t drop column nIdentity 
 
EXEC sp_rename 'purchase_t.tmpIdentity','nIdentity','COLUMN'
GO

--ap
alter table ap_t add tmpIdentity numeric(8,0) not null constraint df_ap_t_tmpIdentity default 0
 go
update ap_t set tmpIdentity = nIdentity
 
alter table ap_t drop constraint df_ap_t_tmpIdentity
alter table ap_t drop column nIdentity 
 
EXEC sp_rename 'ap_t.tmpIdentity','nIdentity','COLUMN'
GO

--Voucher
alter table VOUCHER_TRADE add tmpIdentity numeric(8,0) not null constraint df_VOUCHER_TRADE_tmpIdentity default 0
 go
update VOUCHER_TRADE set tmpIdentity = nIdentity
 
alter table VOUCHER_TRADE drop constraint df_VOUCHER_TRADE_tmpIdentity
alter table VOUCHER_TRADE drop column nIdentity 
 
EXEC sp_rename 'VOUCHER_TRADE.tmpIdentity','nIdentity','COLUMN'
GO

--Voucher
alter table VOUCHER_PAYMENT add tmpIdentity numeric(8,0) not null constraint df_VOUCHER_PAYMENT_tmpIdentity default 0
 go
update VOUCHER_PAYMENT set tmpIdentity = nIdentity
 
alter table VOUCHER_PAYMENT drop constraint df_VOUCHER_PAYMENT_tmpIdentity
alter table VOUCHER_PAYMENT drop column nIdentity 
 
EXEC sp_rename 'VOUCHER_PAYMENT.tmpIdentity','nIdentity','COLUMN'
GO

--Voucher
alter table VOUCHER_OPEX add tmpIdentity numeric(8,0) not null constraint df_VOUCHER_OPEX_tmpIdentity default 0
 go
update VOUCHER_OPEX set tmpIdentity = nIdentity
 
alter table VOUCHER_OPEX drop constraint df_VOUCHER_OPEX_tmpIdentity
alter table VOUCHER_OPEX drop column nIdentity 
 
EXEC sp_rename 'VOUCHER_OPEX.tmpIdentity','nIdentity','COLUMN'
GO

--Voucher
alter table VOUCHER_NONTRADE add tmpIdentity numeric(8,0) not null constraint df_VOUCHER_NONTRADE_tmpIdentity default 0
 go
update VOUCHER_NONTRADE set tmpIdentity = nIdentity
 
alter table VOUCHER_NONTRADE drop constraint df_VOUCHER_NONTRADE_tmpIdentity
alter table VOUCHER_NONTRADE drop column nIdentity 
 
EXEC sp_rename 'VOUCHER_NONTRADE.tmpIdentity','nIdentity','COLUMN'
GO
 
--Check CLEARED
alter table CLEARED_T add tmpIdentity numeric(8,0) not null constraint df_CLEARED_T_tmpIdentity default 0
 go
update CLEARED_T set tmpIdentity = nIdentity
 
alter table CLEARED_T drop constraint df_CLEARED_T_tmpIdentity
alter table CLEARED_T drop column nIdentity 
 
EXEC sp_rename 'CLEARED_T.tmpIdentity','nIdentity','COLUMN'
GO

-- ISSUED
alter table ISSUED_T add tmpIdentity numeric(8,0) not null constraint df_ISSUED_T_tmpIdentity default 0
 go
update ISSUED_T set tmpIdentity = nIdentity
 
alter table ISSUED_T drop constraint df_ISSUED_T_tmpIdentity
alter table ISSUED_T drop column nIdentity 
 
EXEC sp_rename 'ISSUED_T.tmpIdentity','nIdentity','COLUMN'
GO

-- PAYABLES_ACCOUNT
alter table PAYABLES_ACCOUNT add tmpIdentity numeric(8,0) not null constraint df_PAYABLES_ACCOUNT_tmpIdentity default 0
 go
update PAYABLES_ACCOUNT set tmpIdentity = nIdentity
 
alter table PAYABLES_ACCOUNT drop constraint df_PAYABLES_ACCOUNT_tmpIdentity
alter table PAYABLES_ACCOUNT drop column nIdentity 
 
EXEC sp_rename 'PAYABLES_ACCOUNT.tmpIdentity','nIdentity','COLUMN'
GO

-- WRR

alter table WRR_T add tmpIdentity numeric(8,0) not null constraint df_WRR_T_tmpIdentity default 0
 go
update WRR_T set tmpIdentity = nIdentity
 
alter table WRR_T drop constraint df_WRR_T_tmpIdentity
alter table WRR_T drop column nIdentity 
 
EXEC sp_rename 'WRR_T.tmpIdentity','nIdentity','COLUMN'
GO

-- INVADJ

alter table INVADJ_T add tmpIdentity numeric(8,0) not null constraint df_INVADJ_T_tmpIdentity default 0
 go
update INVADJ_T set tmpIdentity = nIdentity
 
alter table INVADJ_T drop constraint df_INVADJ_T_tmpIdentity
alter table INVADJ_T drop column nIdentity 
 
EXEC sp_rename 'INVADJ_T.tmpIdentity','nIdentity','COLUMN'
GO

-- TRANSFER_IN

alter table TRANSFER_IN add tmpIdentity numeric(8,0) not null constraint df_TRANSFER_IN_tmpIdentity default 0
 go
update TRANSFER_IN set tmpIdentity = nIdentity
 
alter table TRANSFER_IN drop constraint df_TRANSFER_IN_tmpIdentity
alter table TRANSFER_IN drop column nIdentity 
 
EXEC sp_rename 'TRANSFER_IN.tmpIdentity','nIdentity','COLUMN'
GO

-- TRANSFER_OUT

alter table TRANSFER_OUT add tmpIdentity numeric(8,0) not null constraint df_TRANSFER_OUT_tmpIdentity default 0
 go
update TRANSFER_OUT set tmpIdentity = nIdentity
 
alter table TRANSFER_OUT drop constraint df_TRANSFER_OUT_tmpIdentity
alter table TRANSFER_OUT drop column nIdentity 
 
EXEC sp_rename 'TRANSFER_OUT.tmpIdentity','nIdentity','COLUMN'
GO


-- production

alter table PRODUCTION_BM add tmpIdentity numeric(8,0) not null constraint df_PRODUCTION_BM_tmpIdentity default 0
 go
update PRODUCTION_BM set tmpIdentity = nIdentity
 
alter table PRODUCTION_BM drop constraint df_PRODUCTION_BM_tmpIdentity
alter table PRODUCTION_BM drop column nIdentity 
 
EXEC sp_rename 'PRODUCTION_BM.tmpIdentity','nIdentity','COLUMN'
GO


alter table PRODUCTION_FG add tmpIdentity numeric(8,0) not null constraint df_PRODUCTION_FG_tmpIdentity default 0
 go
update PRODUCTION_FG set tmpIdentity = nIdentity
 
alter table PRODUCTION_FG drop constraint df_PRODUCTION_FG_tmpIdentity
alter table PRODUCTION_FG drop column nIdentity 
 
EXEC sp_rename 'PRODUCTION_FG.tmpIdentity','nIdentity','COLUMN'
GO

-- GL_T

alter table GL_T add tmpIdentity numeric(8,0) not null constraint df_GL_T_tmpIdentity default 0
 go
update GL_T set tmpIdentity = nIdentity
 
alter table GL_T drop constraint df_GL_T_tmpIdentity
alter table GL_T drop column nIdentity 
 
EXEC sp_rename 'GL_T.tmpIdentity','nIdentity','COLUMN'
GO


-- Intar
alter table INTAR_A add tmpIdentity numeric(8,0) not null constraint df_INTAR_A_tmpIdentity default 0
 go
update INTAR_A set tmpIdentity = nIdentity
 
alter table INTAR_A drop constraint df_INTAR_A_tmpIdentity
alter table INTAR_A drop column nIdentity 
 
EXEC sp_rename 'INTAR_A.tmpIdentity','nIdentity','COLUMN'
GO
--
alter table INTAR_T add tmpIdentity numeric(8,0) not null constraint df_INTAR_T_tmpIdentity default 0
 go
update INTAR_T set tmpIdentity = nIdentity
 
alter table INTAR_T drop constraint df_INTAR_T_tmpIdentity
alter table INTAR_T drop column nIdentity 
 
EXEC sp_rename 'INTAR_T.tmpIdentity','nIdentity','COLUMN'
GO
--

alter table INTAR_C add tmpIdentity numeric(8,0) not null constraint df_INTAR_C_tmpIdentity default 0
 go
update INTAR_C set tmpIdentity = nIdentity
 
alter table INTAR_C drop constraint df_INTAR_C_tmpIdentity
alter table INTAR_C drop column nIdentity 
 
EXEC sp_rename 'INTAR_C.tmpIdentity','nIdentity','COLUMN'
GO


--FIXEDASSETDEPRE
alter table FIXEDASSETDEPRE_T add tmpIdentity numeric(8,0) not null constraint df_FIXEDASSETDEPRE_T_tmpIdentity default 0
 go
update FIXEDASSETDEPRE_T set tmpIdentity = nIdentity
 
alter table FIXEDASSETDEPRE_T drop constraint df_FIXEDASSETDEPRE_T_tmpIdentity
alter table FIXEDASSETDEPRE_T drop column nIdentity 
 
EXEC sp_rename 'FIXEDASSETDEPRE_T.tmpIdentity','nIdentity','COLUMN'
GO

--deposit_t
alter table deposit_t add tmpIdentity numeric(8,0) not null constraint df_deposit_t_tmpIdentity default 0
 go
update deposit_t set tmpIdentity = nIdentity
 
alter table deposit_t drop constraint df_deposit_t_tmpIdentity
alter table deposit_t drop column nIdentity 
 
EXEC sp_rename 'deposit_t.tmpIdentity','nIdentity','COLUMN'
GO

-- PULLED_t

alter table PULLED_t add tmpIdentity numeric(8,0) not null constraint df_PULLED_t_tmpIdentity default 0
 go
update PULLED_t set tmpIdentity = nIdentity
 
alter table PULLED_t drop constraint df_PULLED_t_tmpIdentity
alter table PULLED_t drop column nIdentity 
 
EXEC sp_rename 'PULLED_t.tmpIdentity','nIdentity','COLUMN'
GO

-- replaced_t

alter table replaced_t add tmpIdentity numeric(8,0) not null constraint df_replaced_t_tmpIdentity default 0
 go
update replaced_t set tmpIdentity = nIdentity
 
alter table replaced_t drop constraint df_replaced_t_tmpIdentity
alter table replaced_t drop column nIdentity 
 
EXEC sp_rename 'replaced_t.tmpIdentity','nIdentity','COLUMN'
GO

-- BOUNCED_t

alter table BOUNCED_t add tmpIdentity numeric(8,0) not null constraint df_BOUNCED_t_tmpIdentity default 0
 go
update BOUNCED_t set tmpIdentity = nIdentity
 
alter table BOUNCED_t drop constraint df_BOUNCED_t_tmpIdentity
alter table BOUNCED_t drop column nIdentity 
 
EXEC sp_rename 'BOUNCED_t.tmpIdentity','nIdentity','COLUMN'
GO